<?php
namespace SysAdmin\Controller;
use Think\Controller;
header("content-type:text/html;charset=utf-8");
class SystemController extends LoginTrueController{
    public function System(){
        $this->LoginTrue();
        $systemInfo=M("system");
        $rs_systemInfo=$systemInfo->where("sId=1")->find();
        $this->assign("rs_systemInfo",$rs_systemInfo);
        $this->display();
    }
	public function SystemAction(){
        $this->LoginTrue();
       
			$content =  str_replace("\\","",$s);
            $upload = new \Think\Upload();// 实例化上传类
            $upload->maxSize   =     3145728 ;// 设置附件上传大小
            $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
            $upload->rootPath  =     './uploads/lunboimg/'; // 设置附件上传根目录
            $upload->savePath  =     ''; // 设置附件上传（子）目录
	   
        $data["sName"]=$_POST["sName"];
        $data["sCompany"]=$_POST["sCompany"];
        $data["sCompanyTel"]=$_POST["sCompanyTel"];
        $data["sCompanyName"]=$_POST["sCompanyName"];
        $data["sCheckCodeSwitch1"]=$_POST["sCheckCodeSwitch1"];
        $data["sRegUserCheckCode"]=$_POST["sRegUserCheckCode"];
        $data["tjcheckcode"]=$_POST["tjcheckcode"];
        $data["hdp1url"]=$_POST["hdp1url"];
        $data["hdp2url"]=$_POST["hdp2url"];
        $data["hdp3url"]=$_POST["hdp3url"];
       
       
	   
		
                    // 上传文件
                    $info   =   $upload->upload();
		 if($_FILES['hdp1']['name']){
                    if(!$info) {// 上传错误提示错误信息
                        $this->error($upload->getError());
                    }else{
                         $data["hdp1"]= $info['hdp1']['savepath'].$info['hdp1']['savename'];
                       
                    }
         }
		 if($_FILES['hdp2']['name']){
                    // 上传文件
                 //   $info   =   $upload->upload();
                    if(!$info) {// 上传错误提示错误信息
                        $this->error($upload->getError());
                    }else{
                         $data["hdp2"]= $info['hdp2']['savepath'].$info['hdp2']['savename'];
                       
                    }
         }
		 if($_FILES['hdp3']['name']){
                    // 上传文件
                  //  $info   =   $upload->upload();
                    if(!$info) {// 上传错误提示错误信息
                        $this->error($upload->getError());
                    }else{
                         $data["hdp3"]= $info['hdp3']['savepath'].$info['hdp3']['savename'];
                       
                    }
         }
		 if($_FILES['sLogo']['name']){
                    // 上传文件
                 //   $info   =   $upload->upload();
                    if(!$info) {// 上传错误提示错误信息
                        $this->error($upload->getError());
                    }else{
                         $data["slogo"]= $info['sLogo']['savepath'].$info['sLogo']['savename'];
                       
                    }
         }
		 
        $systemInfo=M("system");
        $result=$systemInfo->where("sid=1")->save($data);
        if($result){
            $this->success("系统更新成功");
        }else{
            $this->error("系统更新失败");
        }
	}
    public function SystemParam(){
        $this->LoginTrue();

        $systemInfo=M("sys_set");
        $rs_systemInfo=$systemInfo->where("id=1")->find();


        $from = date("H:i",$rs_systemInfo["guanbegin"]);
        $end = date("H:i",$rs_systemInfo["guanend"]);

        $this->assign("from",$from);
        $this->assign("end",$end);
        $this->assign("rs_systemInfo",$rs_systemInfo);
        $this->display();
    }
	public function SystemParamAction(){
        $this->LoginTrue();
		
        $systemInfo=M("sys_set");
        $result=$systemInfo->where("id=1")->save($_POST);
        if($result){
            $this->success("系统更新成功");
        }else{
            $this->error("系统更新失败");
        }
	}
	
  
}